package com.class06.advice;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

@Aspect
@Service
@Order(1) // 数值越小，优先级越高
public class TestB {
    //    超前

    @Before("execution(* com..HelloService.*(..))")
    public void pre() {
        System.out.println("B前置通知----------");
    }

    @AfterReturning(value = "execution(* com..HelloService.*(..))", returning = "result")
    public void afterReturning(String result) {
        System.out.println("B返回值是：" + result+"---------");
        System.out.println("B返回通知----------");
    }

    @After("execution(* com..HelloService.*(..))")
    public void after() {
        System.out.println("B后置通知----------");
    }
}
